package com.ibigcat.module.mdm.dao.mapper;

import java.util.*;

import com.ibigcat.framework.common.pojo.PageResult;
import com.ibigcat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.ibigcat.framework.mybatis.core.mapper.BaseMapperX;
import com.ibigcat.module.mdm.dao.entity.CodeRuleSetDO;
import org.apache.ibatis.annotations.Mapper;
import com.ibigcat.module.mdm.controller.admin.coderuleset.vo.*;

/**
 * 编码规则配置明细 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CodeRuleSetMapper extends BaseMapperX<CodeRuleSetDO> {

    default PageResult<CodeRuleSetDO> selectPage(CodeRuleSetPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CodeRuleSetDO>()
                .eqIfPresent(CodeRuleSetDO::getCodeRuleId, reqVO.getCodeRuleId())
                .eqIfPresent(CodeRuleSetDO::getRuleOrder, reqVO.getRuleOrder())
                .eqIfPresent(CodeRuleSetDO::getRule, reqVO.getRule())
                .eqIfPresent(CodeRuleSetDO::getRuleValue, reqVO.getRuleValue())
                .eqIfPresent(CodeRuleSetDO::getOrderNumDigit, reqVO.getOrderNumDigit())
                .eqIfPresent(CodeRuleSetDO::getOrderNumInitial, reqVO.getOrderNumInitial())
                .betweenIfPresent(CodeRuleSetDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CodeRuleSetDO::getId));
    }

}